<template>
  <div class="main">
    <Header class="main_header"/>
    <div style="height: 63px;"></div>
    <div class="main_body">
      <div class="main_body_menu">
        <div v-for="(item,index) in menu" :key="index">
          <router-link :to="item.router">
            <div @click="addClass(index)" :class="{'isActive':isActive===index}" class="main_body_menu_item">
              {{ item.content }}
            </div>
          </router-link>
        </div>
      </div>
      <div class="main_body_msg">
        <router-view></router-view>
      </div>
    </div>
  </div>

</template>

<script setup lang="ts">
import Header from '@/components/header/index.vue'
import {ref} from "vue";

//是否激活
const isActive = ref(-1)

//导航条动态样式
const addClass = (index: number) => {
  isActive.value = index
}

const menu = [
  {
    router: "/inform/comment",
    content: "评论"
  },
  {
    router: "/inform/invite",
    content: "邀请"
  },
  {
    router: "/inform/fans",
    content: "新增粉丝"
  },
  {
    router: "/inform/likeAndCollect",
    content: "赞和收藏"
  },
  {
    router: "/inform/friendApply",
    content: "好友申请"
  },
  {
    router: "/inform/systemInform",
    content: "系统通知"
  },
]
</script>

<style lang="less" scoped>
.main {
  height: 100%;
  width: 100%;

  .main_header {
    height: 70px;
    position: fixed;
    width: 100%;
    z-index: 99999;
  }

  .main_body {
    display: flex;
    margin-top: 20px;
    margin-left: 15%;
    margin-right: 15%;
    justify-content: center;

    .main_body_menu {

      .main_body_menu_item {
        font-size: 17px;
        padding: 10px;
        width: 200px;
        text-align: center;
        background-color: #ffffff;
        border-bottom: 1px solid #f0f0f0;
      }

      .isActive {
        background-color: #b3ffab;
      }

      .main_body_menu_item:hover {
        background-color: #39F3BB;
      }
    }

    .main_body_msg {
      background-color: rgba(0, 0, 0, 0.1);
      margin-left: 10px;
      width: 100%;
      background-color: #ffffff;
    }
  }
}
</style>